package com.example.demo.controller;

import com.example.demo.annotation.AuthValidate;
import com.example.demo.base.ReqParamBody;
import com.example.demo.base.Result;
import com.example.demo.vo.DemoVO;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
public class DemoController {

    /**
     * 自定义注解-检查token
     * @param param
     * @return Result
     */
    @AuthValidate
    @RequestMapping("/demo/annotation/checkToken")
    public Result checkToken(@Valid @RequestBody ReqParamBody<DemoVO> param) {
        return Result.success();
    }

    /**
     * 自定义注解-不检查token
     * @param param
     * @return Result
     */
    @AuthValidate(token = false)
    @RequestMapping("/demo/annotation/notCheckToken")
    public Result notCheckToken(@Valid @RequestBody ReqParamBody<DemoVO> param) {
        return Result.success();
    }
}
